package bma.common.langutil.objectquery.impl;

import java.lang.reflect.Method;

import bma.common.langutil.core.ExceptionUtil;

public class IAccessMethod implements IAccess {

	private String objectType;
	Method method;

	public IAccessMethod(String otype, Method method) {
		super();
		this.objectType = otype;
		this.method = method;
	}

	@Override
	public String getObjectType() {
		return objectType;
	}

	public void setObjectType(String objectType) {
		this.objectType = objectType;
	}

	@Override
	public Object getValue(Object obj) {
		try {
			return this.method.invoke(obj);
		} catch (Exception e) {
			throw ExceptionUtil.throwRuntime(e);
		}
	}

}
